import request from '@/utils/request'

// 1添加系列
export function seriesAdd(data) {
  return request({
    url: '/series/seriesAdd',
    method: 'post',
    headers: {
    	'Content-Type': 'multipart/form-data',
    	'type': 'upfile'
    },
    data,
    transformRequest: [function(data, headers) {
    	const formData = new FormData()
    	for (const key of Object.keys(data)) {
    		formData.append(key, data[key])
    	}
    	return formData
    }]
  })
}
// 2编辑系列
export function seriesEdit(data) {
  return request({
    url: '/series/seriesEdit',
    method: 'post',
    headers: {
    	'Content-Type': 'multipart/form-data',
    	'type': 'upfile'
    },
    data,
    transformRequest: [function(data, headers) {
    	const formData = new FormData()
    	for (const key of Object.keys(data)) {
    		formData.append(key, data[key])
    	}
    	return formData
    }]
  })
}
// 3获取系列详情
export function getSeriesDetail(data) {
  return request({
    url: '/series/getSeriesDetail',
    method: 'post',
    data
  })
}
// 4删除系列
export function delSeries(data) {
  return request({
    url: '/series/delSeries',
    method: 'post',
    data
  })
}
// 5系列上下架
export function opSeriesStatus(data) {
  return request({
    url: '/series/opSeriesStatus',
    method: 'post',
    data
  })
}
// 6获取系列列表
export function seriesIdx(data) {
  return request({
    url: '/series/index',
    method: 'post',
    data
  })
}
